package com.hundredhealth.rose.delegate;

import android.support.v4.widget.SwipeRefreshLayout;

import com.hundredhealth.rose.R;
import com.hundredhealth.rose.base.delegate.BaseListDelegate;
import com.hundredhealth.rose.widget.EmptyLayout;

/**
 * Created by huazhong on 26/6/2017.
 */

public class PullListDelegate extends BaseListDelegate {

    public EmptyLayout mEmptyLayout;

    @Override
    public void initWidget() {
        super.initWidget();
        mEmptyLayout = new EmptyLayout(getActivity());
        setEmptyLayout(mEmptyLayout);
    }

    public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener l) {
        SwipeRefreshLayout swipeRefreshLayout = get(R.id.swiperefreshlayout);
        swipeRefreshLayout.setOnRefreshListener(l);
    }

    public void setBackgroundImage(int resId) {
        mEmptyLayout.setBackgroundResource(resId);
        get(com.hundredhealth.rose.base.R.id.swiperefreshlayout).setBackgroundResource(resId);
    }
}